home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / runner1a / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-15  |  25.8 KB  |  784 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "AutoRun"
  6.    ClientHeight    =   3810
  7.    ClientLeft      =   45
  8.    ClientTop       =   405
  9.    ClientWidth     =   9840
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3810
  14.    ScaleWidth      =   9840
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   3  'Windows Default
  17.    Visible         =   0   'False
  18.    Begin VB.ListBox List1 
  19.       Height          =   2595
  20.       Left            =   10080
  21.       TabIndex        =   7
  22.       Top             =   600
  23.       Width           =   1575
  24.    End
  25.    Begin VB.CommandButton Command5 
  26.       Caption         =   "Save"
  27.       BeginProperty Font 
  28.          Name            =   "MS Sans Serif"
  29.          Size            =   9.75
  30.          Charset         =   0
  31.          Weight          =   400
  32.          Underline       =   0   'False
  33.          Italic          =   0   'False
  34.          Strikethrough   =   0   'False
  35.       EndProperty
  36.       Height          =   375
  37.       Left            =   5040
  38.       TabIndex        =   6
  39.       Top             =   120
  40.       Visible         =   0   'False
  41.       Width           =   1335
  42.    End
  43.    Begin VB.Timer Timer2 
  44.       Enabled         =   0   'False
  45.       Interval        =   4000
  46.       Left            =   600
  47.       Top             =   3840
  48.    End
  49.    Begin MSComctlLib.ListView lvListView 
  50.       Height          =   2895
  51.       Left            =   120
  52.       TabIndex        =   2
  53.       Top             =   600
  54.       Width           =   9615
  55.       _ExtentX        =   16960
  56.       _ExtentY        =   5106
  57.       View            =   3
  58.       LabelEdit       =   1
  59.       LabelWrap       =   -1  'True
  60.       HideSelection   =   -1  'True
  61.       Checkboxes      =   -1  'True
  62.       FullRowSelect   =   -1  'True
  63.       _Version        =   393217
  64.       Icons           =   "ImageList1"
  65.       SmallIcons      =   "ImageList1"
  66.       ColHdrIcons     =   "ImageList1"
  67.       ForeColor       =   16777215
  68.       BackColor       =   -2147483645
  69.       BorderStyle     =   1
  70.       Appearance      =   1
  71.       NumItems        =   1
  72.       BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  73.          Object.Width           =   2540
  74.       EndProperty
  75.    End
  76.    Begin VB.CommandButton Command4 
  77.       Caption         =   "Scan for New Entries"
  78.       BeginProperty Font 
  79.          Name            =   "MS Sans Serif"
  80.          Size            =   9.75
  81.          Charset         =   0
  82.          Weight          =   400
  83.          Underline       =   0   'False
  84.          Italic          =   0   'False
  85.          Strikethrough   =   0   'False
  86.       EndProperty
  87.       Height          =   375
  88.       Left            =   120
  89.       TabIndex        =   5
  90.       Top             =   120
  91.       Width           =   2295
  92.    End
  93.    Begin VB.Timer Timer1 
  94.       Enabled         =   0   'False
  95.       Interval        =   250
  96.       Left            =   120
  97.       Top             =   3840
  98.    End
  99.    Begin VB.CommandButton Command3 
  100.       Caption         =   "De-Select All"
  101.       BeginProperty Font 
  102.          Name            =   "MS Sans Serif"
  103.          Size            =   9.75
  104.          Charset         =   0
  105.          Weight          =   400
  106.          Underline       =   0   'False
  107.          Italic          =   0   'False
  108.          Strikethrough   =   0   'False
  109.       EndProperty
  110.       Height          =   375
  111.       Left            =   8160
  112.       TabIndex        =   4
  113.       Top             =   120
  114.       Width           =   1575
  115.    End
  116.    Begin VB.CommandButton Command2 
  117.       Caption         =   "Select All"
  118.       BeginProperty Font 
  119.          Name            =   "MS Sans Serif"
  120.          Size            =   9.75
  121.          Charset         =   0
  122.          Weight          =   400
  123.          Underline       =   0   'False
  124.          Italic          =   0   'False
  125.          Strikethrough   =   0   'False
  126.       EndProperty
  127.       Height          =   375
  128.       Left            =   6600
  129.       TabIndex        =   3
  130.       Top             =   120
  131.       Width           =   1455
  132.    End
  133.    Begin MSComctlLib.ImageList ImageList1 
  134.       Left            =   4680
  135.       Top             =   1680
  136.       _ExtentX        =   1005
  137.       _ExtentY        =   1005
  138.       BackColor       =   -2147483643
  139.       ImageWidth      =   20
  140.       ImageHeight     =   20
  141.       MaskColor       =   12632256
  142.       _Version        =   393216
  143.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  144.          NumListImages   =   1
  145.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  146.             Picture         =   "Form1.frx":0000
  147.             Key             =   ""
  148.          EndProperty
  149.       EndProperty
  150.    End
  151.    Begin MSComctlLib.StatusBar StatusBar1 
  152.       Align           =   2  'Align Bottom
  153.       Height          =   255
  154.       Left            =   0
  155.       TabIndex        =   0
  156.       Top             =   3555
  157.       Width           =   9840
  158.       _ExtentX        =   17357
  159.       _ExtentY        =   450
  160.       Style           =   1
  161.       _Version        =   393216
  162.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  163.          NumPanels       =   1
  164.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  165.          EndProperty
  166.       EndProperty
  167.    End
  168.    Begin VB.CommandButton Command1 
  169.       Caption         =   "Load List"
  170.       BeginProperty Font 
  171.          Name            =   "MS Sans Serif"
  172.          Size            =   9.75
  173.          Charset         =   0
  174.          Weight          =   400
  175.          Underline       =   0   'False
  176.          Italic          =   0   'False
  177.          Strikethrough   =   0   'False
  178.       EndProperty
  179.       Height          =   375
  180.       Left            =   600
  181.       TabIndex        =   1
  182.       Top             =   1440
  183.       Visible         =   0   'False
  184.       Width           =   1215
  185.    End
  186.    Begin VB.Data Data1 
  187.       Caption         =   "Data1"
  188.       Connect         =   "Access"
  189.       DatabaseName    =   ""
  190.       DefaultCursorType=   0  'DefaultCursor
  191.       DefaultType     =   2  'UseODBC
  192.       Exclusive       =   0   'False
  193.       Height          =   375
  194.       Left            =   480
  195.       Options         =   0
  196.       ReadOnly        =   0   'False
  197.       RecordsetType   =   1  'Dynaset
  198.       RecordSource    =   ""
  199.       Top             =   2040
  200.       Width           =   2055
  201.    End
  202. Attribute VB_Name = "Form1"
  203. Attribute VB_GlobalNameSpace = False
  204. Attribute VB_Creatable = False
  205. Attribute VB_PredeclaredId = True
  206. Attribute VB_Exposed = False
  207. Option Explicit
  208. 'Private WithEvents m_cSplit As cSplitter
  209. Private cReg As New cRegistry
  210. Dim cancelled As Boolean
  211. Dim retval As Boolean
  212. Dim c As New cRegistry
  213. Dim listitemadd As ListItem
  214. Dim j As Integer, k As Integer
  215. Dim sKeys() As String, iKeyCount As Long, bkey As String, ikey As Integer, dell As String, ell As String
  216. Dim rell As String, gell As String, hell As String, nell As String, dill As String, fril As Integer
  217. Dim nname As String, nkey As String, nsubkey As String, npath As String
  218. Dim r As Long, q As Integer, l As Integer
  219. Dim pathSpec As String
  220. Dim chrsin As String, chrsout As String, idx, fuss As String, exet As Integer
  221. Function Getname(name As String)
  222. fuss = name '"C:\Windows\Startm~1\Programs\Startup\Shortcut to PDesk.lnk"
  223. If InStr(fuss, "\") Then
  224.    For idx = Len(fuss) To 1 Step -1
  225.        If Mid(fuss, idx, 1) = "\" Then
  226.           chrsout = Mid(fuss, idx + 36)
  227.           exet = Len(chrsout)
  228.           exet = exet - 3
  229.           '
  230.        End If
  231.    Next idx
  232. End If
  233. End Function
  234. Function Validate_File(ByVal FileName As String) As Integer
  235.        Dim fileFile As Integer
  236.        '     'attempt to open file
  237.        fileFile = FreeFile
  238.        On Error Resume Next
  239.        Open FileName For Input As fileFile
  240.        '     'check for error
  241.               If Err Then
  242.                      Validate_File = False
  243.               Else
  244.                      '     'file exists
  245.                      '     'close file
  246.                      Close fileFile
  247.                      Validate_File = True
  248.               End If
  249. End Function
  250. Function sLongName(sShortName As String) As String
  251.        Dim sTemp As String
  252.        Dim sNew As String
  253.        Dim iHasBS As Integer
  254.        Dim iBS As Integer
  255.        If Len(sShortName) = 0 Then Exit Function
  256.        sTemp = sShortName
  257.        If Right$(sTemp, 1) = "\" Then
  258.            sTemp = Left$(sTemp, Len(sTemp) - 1)
  259.            iHasBS = True
  260.        End If
  261.        On Error GoTo MSGLFNnofile
  262.        If InStr(sTemp, "\") Then
  263.            sNew = ""
  264.            Do While InStr(sTemp, "\")
  265.                If Len(sNew) Then
  266.                    sNew = Dir$(sTemp, 54) & "\" & sNew
  267.                Else
  268.                    sNew = Dir$(sTemp, 54)
  269.                    If sNew = "" Then
  270.                        sLongName = sShortName
  271.                        Exit Function
  272.                    End If
  273.                End If
  274.                On Error Resume Next
  275.                For iBS = Len(sTemp) To 1 Step -1
  276.                    If ("\" = Mid$(sTemp, iBS, 1)) Then
  277.                        'found it
  278.                        Exit For
  279.                    End If
  280.                Next iBS
  281.                sTemp = Left$(sTemp, iBS - 1)
  282.            Loop
  283.            sNew = sTemp & "\" & sNew
  284.        Else
  285.            sNew = Dir$(sTemp, 54)
  286.        End If
  287.    Data1.Recordset.AddNew
  288. Dim stir As String
  289.    stir = InputBox$("FindDirectory of Application", "Find Application", "Full Path Shortcut Refers To", 150, 150) ' without commondialog
  290.    'With CommonDialog1                   '  for use with common dialog
  291.     ' .DialogTitle = "Find Application"  '  for use with common dialog
  292.      '.CancelError = False               '  for use with common dialog
  293.      '.DefaultExt = ".exe"               '  for use with common dialog
  294.      '.InitDir = "C:\Windows\"           '  for use with common dialog
  295.      '.ShowOpen                          '  for use with common dialog
  296.      'stir = .FileName                   '  for use with common dialog
  297.   ' End With                             '  for use with common dialog
  298. If stir = "" Or stir = "Full Path Shortcut Refers To" Then Exit Function
  299.    stir = Short_Name(stir)
  300.    retval = Validate_File(stir)
  301.    If retval = False Then Exit Function
  302.    Data1.Recordset.Fields("Name") = List1.Text
  303.    Data1.Recordset.Fields("Key") = "Start Menu"
  304.    Data1.Recordset.Fields("Path") = sNew
  305.    Data1.Recordset.Fields("AppLocation") = stir
  306.    Data1.Recordset.Fields("Checked") = True
  307.    Data1.Recordset.Fields("Subkey") = "C:\Windows\Startm~1\Programs\StartUp"
  308.    Data1.UpdateRecord
  309.    fril = fril + 1
  310. MSGLFNresume:
  311.        If iHasBS Then
  312.            sNew = sNew & "\"
  313.        End If
  314.        sLongName = sNew
  315.        Exit Function
  316. MSGLFNnofile:
  317.        sNew = ""
  318.        Resume MSGLFNresume
  319.    End Function
  320. Function TestName(test As String)
  321. Dim str As String
  322. On Error GoTo errmsg
  323. Data1.RecordSource = ("SELECT * FROM [Runit] WHERE [Name]Like """ & test & "*""")
  324. Data1.Refresh
  325. str = Data1.Recordset.Fields("Path")
  326. Exit Function
  327. errmsg:
  328. If Err.Number = 3021 Then
  329. MsgBox " New Entry Found in Registry.  Click on Select All then Right after, (You have 5 Seconds), Click on Scan for New Entries to Create a new Database"
  330. cancelled = True
  331. End If
  332. End Function
  333. Function Scannew()
  334. Dim umm As Integer, frd As String
  335. umm = 1
  336. With c
  337.          
  338.          .ClassKey = rell
  339.          .SectionKey = dell
  340.          bkey = .EnumerateValues(sKeys(), iKeyCount)
  341.          
  342.          For ikey = 1 To iKeyCount
  343.              Debug.Print sKeys(ikey)
  344.              frd = sKeys(ikey)
  345.              TestName (frd)
  346.              umm = umm + 1
  347.          Next ikey
  348.          
  349. End With
  350. With c
  351.          .ClassKey = hell
  352.          .SectionKey = nell
  353.          bkey = .EnumerateValues(sKeys(), iKeyCount)
  354.          For ikey = 1 To iKeyCount
  355.              Debug.Print sKeys(ikey)
  356.              frd = sKeys(ikey)
  357.              TestName (frd)
  358.              umm = umm + 1
  359.          Next ikey
  360. End With
  361. With c
  362.          .ClassKey = gell
  363.          .SectionKey = ell
  364.          bkey = .EnumerateValues(sKeys(), iKeyCount)
  365.          For ikey = 1 To iKeyCount
  366.              Debug.Print sKeys(ikey)
  367.              frd = sKeys(ikey)
  368.              TestName (frd)
  369.              umm = umm + 1
  370.          Next ikey
  371. End With
  372. If cancelled = False Then
  373. MsgBox "Nothing New Found in Registry"
  374. End If
  375. End Function
  376. Function RemoveThing(Thing As Integer)
  377. On Error GoTo dunn
  378. Dim rel, fel As String, nam As String
  379. Data1.RecordSource = ("SELECT * FROM [Runit] WHERE [ID]Like """ & Thing & "*""")
  380. Data1.Refresh
  381. Data1.Recordset.Edit
  382. Data1.Recordset.Fields("Checked") = False
  383. rel = Data1.Recordset.Fields("Key")
  384. fel = Data1.Recordset.Fields("Subkey")
  385. nam = Data1.Recordset.Fields("Name")
  386. Data1.Recordset.Update
  387. Select Case rel
  388. Case "HKEY_LOCAL_MACHINE"
  389. rel = HKEY_LOCAL_MACHINE
  390. Case "HKEY_CURRENT_USER"
  391. rel = HKEY_CURRENT_USER
  392. End Select
  393.  With c
  394.          .ClassKey = rel
  395.          .SectionKey = fel
  396.          .ValueKey = nam
  397.          .DeleteValue
  398.  End With
  399.  Exit Function
  400. dunn:
  401.  If Err.Number = 26001 Then
  402.  Exit Function
  403.  Else
  404.  MsgBox Err.Number
  405.  End If
  406. End Function
  407. Function AddThing(Thing As Integer)
  408. Dim rel As String, fel As String, nam As String, frt As String
  409. Data1.RecordSource = ("SELECT * FROM [Runit] WHERE [ID]Like """ & Thing & "*""")
  410. Data1.Refresh
  411. Data1.Recordset.Edit
  412. Data1.Recordset.Fields("Checked") = True
  413. rel = Data1.Recordset.Fields("Key")
  414. fel = Data1.Recordset.Fields("Subkey")
  415. nam = Data1.Recordset.Fields("Name")
  416. frt = Data1.Recordset.Fields("Path")
  417. Data1.Recordset.Update
  418. Select Case rel
  419.  Case "HKEY_LOCAL_MACHINE"
  420.   Call savestring(HKEY_LOCAL_MACHINE, fel, nam, frt)
  421.  Case "HKEY_CURRENT_USER"
  422.   Call savestring(HKEY_CURRENT_USER, fel, nam, frt)
  423. End Select
  424. End Function
  425. Function ReadBase()
  426. Call Columns
  427. On Error GoTo errmsg
  428.   Data1.Recordset.MoveLast
  429.   j = Data1.Recordset.RecordCount
  430.   Data1.Recordset.MoveFirst
  431.   k = 1
  432. Do Until Data1.Recordset.EOF
  433. Set listitemadd = lvListView.ListItems.Add(, , Data1.Recordset.Fields("Name"), 0)
  434.   lvListView.ListItems(k).Checked = Data1.Recordset.Fields("Checked")
  435.   lvListView.ListItems(k).Tag = Data1.Recordset.Fields("ID")
  436.   listitemadd.SubItems(1) = Data1.Recordset.Fields("Key")
  437.   listitemadd.SubItems(2) = Data1.Recordset.Fields("Path")
  438.   Data1.Recordset.MoveNext
  439.   k = k + 1
  440. Exit Function
  441. errmsg:
  442. If Err.Number = 3021 Then
  443.   With c
  444.          .ClassKey = HKEY_CURRENT_USER
  445.          .SectionKey = "Software\Homeplay\Runner"
  446.          .ValueKey = "Done"
  447.          .DeleteValue
  448.  End With
  449.   MsgBox "There was an Error. Please Restart Runner"
  450.   End
  451. End If
  452. End Function
  453. Function CreateBase()
  454. Call Columns
  455.      With c
  456.          
  457.          .ClassKey = rell
  458.          .SectionKey = dell
  459.          bkey = .EnumerateValues(sKeys(), iKeyCount)
  460.          
  461.          For ikey = 1 To iKeyCount
  462.              Debug.Print sKeys(ikey)
  463.             Set listitemadd = lvListView.ListItems.Add(, , sKeys(ikey), 0)
  464.             lvListView.ListItems(fril).Checked = True
  465.             listitemadd.SubItems(1) = "HKEY_LOCAL_MACHINE"
  466.             listitemadd.SubItems(2) = getstring(HKEY_LOCAL_MACHINE, dell, sKeys(ikey))
  467.          Data1.Recordset.AddNew
  468.          Data1.Recordset.Fields("Name") = sKeys(ikey)
  469.          Data1.Recordset.Fields("ID") = fril
  470.          Data1.Recordset.Fields("Key") = "HKEY_LOCAL_MACHINE"
  471.          Data1.Recordset.Fields("Path") = getstring(HKEY_LOCAL_MACHINE, dell, sKeys(ikey))
  472.          Data1.Recordset.Fields("Subkey") = dell
  473.          Data1.Recordset.Fields("Checked") = True
  474.          Data1.UpdateRecord
  475.          fril = fril + 1
  476.          Next ikey
  477.      End With
  478.      
  479.      With c
  480.          .ClassKey = hell
  481.          .SectionKey = nell
  482.          bkey = .EnumerateValues(sKeys(), iKeyCount)
  483.          For ikey = 1 To iKeyCount
  484.              Debug.Print sKeys(ikey)
  485.             Set listitemadd = lvListView.ListItems.Add(, , sKeys(ikey), 0)
  486.             lvListView.ListItems(fril).Checked = True
  487.             listitemadd.SubItems(1) = "HKEY_LOCAL_MACHINE"
  488.             listitemadd.SubItems(2) = getstring(HKEY_LOCAL_MACHINE, nell, sKeys(ikey))
  489.          Data1.Recordset.AddNew
  490.          Data1.Recordset.Fields("Name") = sKeys(ikey)
  491.          Data1.Recordset.Fields("ID") = fril
  492.          Data1.Recordset.Fields("Key") = "HKEY_LOCAL_MACHINE"
  493.          Data1.Recordset.Fields("Path") = getstring(HKEY_LOCAL_MACHINE, nell, sKeys(ikey))
  494.          Data1.Recordset.Fields("Checked") = True
  495.          Data1.Recordset.Fields("Subkey") = nell
  496.          Data1.UpdateRecord
  497.          fril = fril + 1
  498.          Next ikey
  499.      End With
  500.      
  501.       With c
  502.          .ClassKey = gell
  503.          .SectionKey = ell
  504.          bkey = .EnumerateValues(sKeys(), iKeyCount)
  505.          For ikey = 1 To iKeyCount
  506.              Debug.Print sKeys(ikey)
  507.             Set listitemadd = lvListView.ListItems.Add(, , sKeys(ikey), 0)
  508.             lvListView.ListItems(fril).Checked = True
  509.             listitemadd.SubItems(1) = "HKEY_CURRENT_USER"
  510.             listitemadd.SubItems(2) = getstring(HKEY_CURRENT_USER, dell, sKeys(ikey))
  511.             Data1.Recordset.AddNew
  512.          Data1.Recordset.Fields("Name") = sKeys(ikey)
  513.          Data1.Recordset.Fields("ID") = fril
  514.          Data1.Recordset.Fields("Key") = "HKEY_CURRENT_USER"
  515.          Data1.Recordset.Fields("Path") = getstring(HKEY_CURRENT_USER, dell, sKeys(ikey))
  516.          Data1.Recordset.Fields("Checked") = True
  517.          Data1.Recordset.Fields("Subkey") = dell
  518.          Data1.UpdateRecord
  519.          fril = fril + 1
  520.          Next ikey
  521.      End With
  522.      
  523.      With c
  524.          .ClassKey = gell
  525.          .SectionKey = ell
  526.          bkey = .EnumerateValues(sKeys(), iKeyCount)
  527.          For ikey = 1 To iKeyCount
  528.              Debug.Print sKeys(ikey)
  529.             Set listitemadd = lvListView.ListItems.Add(, , sKeys(ikey), 0)
  530.             lvListView.ListItems(fril).Checked = True
  531.             listitemadd.SubItems(1) = "HKEY_CURRENT_USER"
  532.             listitemadd.SubItems(2) = getstring(HKEY_CURRENT_USER, ell, sKeys(ikey))
  533.             Data1.Recordset.AddNew
  534.          Data1.Recordset.Fields("Name") = sKeys(ikey)
  535.          Data1.Recordset.Fields("Key") = "HKEY_CURRENT_USER"
  536.          Data1.Recordset.Fields("Path") = getstring(HKEY_CURRENT_USER, ell, sKeys(ikey))
  537.          Data1.Recordset.Fields("Checked") = True
  538.          Data1.Recordset.Fields("Subkey") = nell
  539.          Data1.UpdateRecord
  540.          fril = fril + 1
  541.          Next ikey
  542.      End With
  543.      
  544.         l = 1
  545.         pathSpec = "C:\WINDOWS\Startm~1\Programs\StartUp\*.*"
  546.         r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, pathSpec)
  547.         q = List1.ListCount
  548.         Do Until l = q
  549.         List1.ListIndex = l
  550.         sLongName ("C:\WINDOWS\Startm~1\Programs\StartUp\" & List1.Text)
  551.         l = l + 1
  552.         fril = fril + 1
  553.         Loop
  554.      
  555. End Function
  556. Sub Columns()
  557. lvListView.Sorted = False
  558. lvListView.ColumnHeaders.Clear
  559. lvListView.ListItems.Clear
  560.       lvListView.ColumnHeaders.Add
  561.       lvListView.ColumnHeaders.Item(1).Text = "Name"
  562.       lvListView.ColumnHeaders.Item(1).Width = 2700
  563.       lvListView.ColumnHeaders.Add
  564.       lvListView.ColumnHeaders.Item(2).Text = "Location"
  565.       lvListView.ColumnHeaders.Item(2).Width = 2300
  566.       lvListView.ColumnHeaders.Add
  567.       lvListView.ColumnHeaders.Item(3).Text = "Run Path"
  568.       lvListView.ColumnHeaders.Item(3).Width = 5200
  569. End Sub
  570. Private Sub Command1_Click()
  571. Dim dun As String
  572.   dun = getstring(HKEY_CURRENT_USER, "Software\Homeplay\Runner", "Done")
  573. If dun <> "Yes" Then
  574. Call savestring(HKEY_CURRENT_USER, "Software\Homeplay\Runner", "Done", "Yes")
  575.   CreateBase
  576. Exit Sub
  577. End If
  578. If dun = "Yes" Then
  579.   ReadBase
  580. Exit Sub
  581. End If
  582. End Sub
  583. Private Sub Command2_Click()
  584. Command5.Visible = True
  585. Cretnew = True
  586. Timer2.Enabled = True
  587. StatusBar1.SimpleText = ""
  588. Dim i As Integer, k As Integer
  589.  i = lvListView.ListItems.Count
  590.  k = 1
  591. Do Until k = i + 1
  592.   lvListView.ListItems(k).Checked = True
  593.   k = k + 1
  594.   Data1.Recordset.MoveFirst
  595. Do Until Data1.Recordset.EOF
  596.   Data1.Recordset.Edit
  597.   Data1.Recordset.Fields("Checked") = True
  598.   Data1.Recordset.Update
  599.   Data1.Recordset.MoveNext
  600. Data1.RecordSource = "Select * From [Runit]"
  601. Data1.Refresh
  602. Data1.Recordset.MoveFirst
  603. Do Until Data1.Recordset.EOF
  604.   nname = Data1.Recordset.Fields("Name")
  605.   nkey = Data1.Recordset.Fields("Key")
  606.   nsubkey = Data1.Recordset.Fields("Subkey")
  607.   npath = Data1.Recordset.Fields("Path")
  608.   Call Wait(0.125)
  609.   Select Case nkey
  610.   Case "HKEY_LOCAL_MACHINE"
  611.     Call savestring(HKEY_LOCAL_MACHINE, nsubkey, nname, npath)
  612.   Case "HKEY_CURRENT_USER"
  613.     Call savestring(HKEY_CURRENT_USER, nsubkey, nname, npath)
  614.   End Select
  615.   On Error GoTo endr
  616.   Data1.Recordset.MoveNext
  617. endr:
  618. End Sub
  619. Private Sub Command3_Click()
  620. StatusBar1.SimpleText = ""
  621. Command5.Visible = True
  622. Dim i As Integer, k As Integer
  623.   i = lvListView.ListItems.Count
  624.   k = 1
  625. Do Until k = i + 1
  626.   lvListView.ListItems(k).Checked = False
  627.   k = k + 1
  628. Data1.Recordset.MoveFirst
  629. Do Until Data1.Recordset.EOF
  630.   Data1.Recordset.Edit
  631.   Data1.Recordset.Fields("Checked") = False
  632.   Data1.Recordset.Update
  633.   Data1.Recordset.MoveNext
  634. Data1.RecordSource = "Select * From [Runit]"
  635. Data1.Refresh
  636. Data1.Recordset.MoveFirst
  637. Do Until Data1.Recordset.EOF
  638.   nname = Data1.Recordset.Fields("Name")
  639.   nkey = Data1.Recordset.Fields("Key")
  640.   nsubkey = Data1.Recordset.Fields("Subkey")
  641.   npath = Data1.Recordset.Fields("Path")
  642.   Call Wait(0.125)
  643.   Select Case nkey
  644.   Case "HKEY_LOCAL_MACHINE"
  645.     With c
  646.          .ClassKey = HKEY_LOCAL_MACHINE
  647.          .SectionKey = nsubkey
  648.          .ValueKey = nname
  649.          .DeleteValue
  650.     End With
  651.   Case "HKEY_CURRENT_USER"
  652.     Call savestring(HKEY_CURRENT_USER, nsubkey, nname, npath)
  653.     With c
  654.          .ClassKey = HKEY_CURRENT_USER
  655.          .SectionKey = nsubkey
  656.          .ValueKey = nname
  657.          .DeleteValue
  658.  End With
  659.   End Select
  660.   Data1.Recordset.MoveNext
  661. End Sub
  662. Private Sub Command4_Click()
  663. StatusBar1.SimpleText = ""
  664. Command5.Visible = False
  665. If Cretnew = False Then
  666. Scannew
  667. Exit Sub
  668. End If
  669. With c
  670.          .ClassKey = HKEY_CURRENT_USER
  671.          .SectionKey = "Software\Homeplay\Runner"
  672.          .ValueKey = "Done"
  673.          .DeleteValue
  674.  End With
  675.  Columns
  676.  Data1.Recordset.MoveFirst
  677.  Do Until Data1.Recordset.EOF
  678.  Data1.Recordset.Delete
  679.  Data1.Recordset.MoveNext
  680.  Loop
  681. MsgBox "You will need to restart Runner to Create a new database"
  682. End Sub
  683. Private Sub Command5_Click()
  684. MsgBox "Something left for you to do. Once all are selected you will need to save the changes :)"
  685. End Sub
  686. Private Sub Form_Load()
  687.   ikey = 0
  688.   rell = HKEY_LOCAL_MACHINE
  689.   dell = "Software\Microsoft\Windows\CurrentVersion\Run"
  690.   gell = HKEY_CURRENT_USER
  691.   ell = "Software\Microsoft\Windows\CurrentVersion\Run"
  692.   hell = HKEY_LOCAL_MACHINE
  693.   nell = "Software\Microsoft\Windows\CurrentVersion\RunServices"
  694.   fril = 1
  695.   cancelled = False
  696. Data1.DatabaseName = App.Path & "\Runner.mdb"
  697. Data1.RecordSource = "Runit"
  698.     Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
  699.     Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
  700.     Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 9960)
  701.     Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 4230)
  702. Timer1.Enabled = True
  703. End Sub
  704. Private Sub Form_Unload(Cancel As Integer)
  705.     If Me.WindowState <> vbMinimized Then
  706.         SaveSetting App.Title, "Settings", "MainLeft", Me.Left
  707.         SaveSetting App.Title, "Settings", "MainTop", Me.Top
  708.         SaveSetting App.Title, "Settings", "MainWidth", Me.Width
  709.         SaveSetting App.Title, "Settings", "MainHeight", Me.Height
  710.     End If
  711. End Sub
  712. Private Sub lvListView_ItemCheck(ByVal Item As MSComctlLib.ListItem)
  713. Dim agr As String, strr As String
  714. StatusBar1.SimpleText = Item
  715. Command5.Visible = False
  716. Dim tagr As Integer
  717.   lvListView.SelectedItem = Item
  718.  If Not IsNull(lvListView.SelectedItem.Tag) Then
  719.  tagr = lvListView.SelectedItem.Tag
  720.  End If
  721. If Right(Item, 4) = ".lnk" Then
  722. GoTo starmen
  723. End If
  724. If lvListView.SelectedItem.Checked = True Then
  725.   AddThing (tagr)
  726. Exit Sub
  727. End If
  728. If lvListView.SelectedItem.Checked = False Then
  729.   RemoveThing (tagr)
  730. Exit Sub
  731. End If
  732. starmen:
  733. Dim tell As String, apploc As String
  734. If lvListView.SelectedItem.Checked = True Then
  735. agr = lvListView.SelectedItem
  736. Data1.RecordSource = ("Select * From [Runit] Where [Name]Like """ & agr & "*""")
  737. Data1.Refresh
  738. Data1.Recordset.Edit
  739. Data1.Recordset.Fields("Checked") = True
  740. strr = Data1.Recordset.Fields("Path")
  741. apploc = Data1.Recordset.Fields("AppLocation")
  742. Getname (strr)
  743. Data1.Recordset.Update
  744. Dim abb As String, dab As Integer
  745. dab = Len(chrsout)
  746. abb = Mid(chrsout, 1, dab - 4)
  747. Call CreateShortcut(Me, "..", abb, apploc, "")
  748. Call Wait(0.125)
  749. FileCopy ("C:\Windows\Startm~1\" & abb & ".lnk"), ("C:\Windows\Startm~1\Programs\Startup\" & abb & ".lnk")
  750. Call Wait(0.125)
  751. Kill ("C:\Windows\Startm~1\" & abb & ".lnk")
  752. Exit Sub
  753. End If
  754. If lvListView.SelectedItem.Checked = False Then
  755. agr = lvListView.SelectedItem
  756. Data1.RecordSource = ("Select * From [Runit] Where [Name]Like """ & agr & "*""")
  757. Data1.Refresh
  758. Data1.Recordset.Edit
  759. Data1.Recordset.Fields("Checked") = False
  760. Data1.Recordset.Update
  761. strr = Data1.Recordset.Fields("Path")
  762. strr = Short_Name(strr)
  763. retval = Validate_File(strr)
  764. If retval = True Then
  765. Kill strr
  766. End If
  767. Exit Sub
  768. End If
  769. End Sub
  770. Private Sub lvListView_ItemClick(ByVal Item As MSComctlLib.ListItem)
  771. StatusBar1.SimpleText = Item
  772. End Sub
  773. Private Sub Timer1_Timer()
  774.   Command1.Value = True
  775.   Timer1.Enabled = False
  776.   Form1.Visible = True
  777.   StatusBar1.SimpleText = lvListView.ListItems.Count & " Running Applications"
  778. End Sub
  779. Private Sub Timer2_Timer()
  780. Cretnew = False
  781. Command5.Visible = False
  782. Timer2.Enabled = False
  783. End Sub
  784.